Skip to content

fix: make loadTrack reconcile track metadata#14

Open
jeryj wants to merge 1 commit into
arraypress:mainfrom
jeryj:fix-load-track-artwork
Open

fix: make loadTrack reconcile track metadata#14
jeryj wants to merge 1 commit into
arraypress:mainfrom
jeryj:fix-load-track-artwork

Conversation

@jeryj

@jeryj jeryj commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Make loadTrack() a complete in-place track swap for per-track metadata.

Previously, consumers could update the audio source with loadTrack(), but artist and artwork DOM could only be updated when the relevant elements already existed. If a new track added or removed artist/artwork metadata, consumers had to destroy and recreate the player to get the DOM into the right shape.

This updates loadTrack() to reconcile those fields in place:

  • add, update, or remove artist text
  • add, update, or remove artwork
  • update artwork alt text
  • keep artwork alt text in sync when artworkAlt is supplied

Why

This lets consumers switch tracks without tearing down the player instance when metadata presence changes, avoiding unnecessary DOM churn and visible layout shifts.

Testing

  • npm test
  • npm run build

Co-authored-by: Codex codex@openai.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant